package studentcourse.entity;


public class Teacher extends Person {
    //所教课程名
    private String taughtCourse;

    //调用父类构造,初始化特有属性
    public Teacher(String id, String name, String gender, String taughtCourse) {
        super(id, name, gender); // 初始化父类
        this.taughtCourse = taughtCourse;
    }

    //打印
    @Override
    public void printWorksheet() {
        System.out.println("\n=== 教师工作单 ===");
        System.out.println("教师ID：" + this.id);    // 访问父类protected属性
        System.out.println("教师姓名：" + this.name);  // 访问父类protected属性
        System.out.println("教师性别：" + this.gender);// 访问父类protected属性
        System.out.println("所教课程：" + this.taughtCourse);
        System.out.println("==================");
    }

    //外部包访问/修改
    public String getTaughtCourse() {
        return taughtCourse;
    }

    public void setTaughtCourse(String taughtCourse) {
        this.taughtCourse = taughtCourse;
    }
}

